//
// Created by PC on 2024/7/12.
/*
map<string,int> m;
m["nasa"]=12;
set<int> s;
s.insert(12);
 *
 * */
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;

int main()
{
    int n,m,ma;
    cin>>n>>m;
    int l[n][m];
    int add[n]={0};
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin>>l[i][j];
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            if (l[i][j])
            {
                add[i]++;
            }
        }
    }
    ma=0;
    for (int i = 0; i < n; ++i)
    {
        if (add[ma]<add[i])
        {
            ma=i;
        }
    }
    cout<<ma+1;
    return 0;
}